<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="../script/pivot.js"></script>
<script type="text/javascript" src="../script/crosstab.js"></script>
<meta name="author" content="CarlHuang">
<title>人工干预操作</title>
<script language="javascript" src="../script/common.js"
	type="text/javascript"></script>
<script language="javascript" type="text/javascript"> 	
		var qt={};
     function load(){
	   Eui.showNavigation();

	   Common.initDict(viewdate.operateType, "operate_type", "全部");
       Common.initDict(viewdate.state, "change_state", "全部");
	   Common.initDict(viewdate3.nextGrade, "customer_level", "全部");
	   Common.initDict(viewdate2.nextGrade4, "customer_level", "全部");
	   Common.initDict(viewdate5.nextGrade5, "customer_level", "全部");
	   setPages(["listview","listview2","listview3","listview4","xiugaiview"]);
	   createTable();
	 }
		
    function showData1(){
       qt.showTable();
    }
     
	function createTable(){
	   var columns =[];
       columns[7]={title:"操作",width:"9%",align:"center",render:czFunc,order:false}
       columns[8]={title:"操作",width:"9%",align:"center",render:delFunc,order:false}
       columns[9]={title:"操作",width:"9%",align:"center",render:tijiaoFunc,order:false}
	   qt = new QueryTable("grade_change_list","viewdate","datalist",columns,{
					buttons:[{value:"变更申请",actions:onNew}]});
	}	
			
	function xiugai(id,cardid,name,currentgrade,nextgrade,operatetype,state){    
	   $("viewdate5").gradeid.value=id;
	   $("cardid5").innerHTML=cardid;
	   $("username5").innerHTML=name;
	   $("currentLevel5").innerHTML=currentgrade;
	   $("viewdate5").nextGrade5.value=nextgrade;
	   $("state5").innerHTML=state;
	   $("operatorType5").innerHTML=operatetype;
	   switchPage("xiugaiview");
	}
			
	function del(gradeid){
	   DWR.call('gradeService.gradeDelete',gradeid,function(v){
	   createTable();
	   showData1();
	   switchPage('listview');
	   });
	}
			
	function tijiao(gradeid){
	   DWR.call('gradeService.gradeTiJiao',gradeid,function(v){
	   createTable();
	   showData1();
	   switchPage('listview');
	   });
	}
			
	function fanhui1(){
	   viewdate.reset();
	   switchPage("listview");
	}
			
	function fanhui2(){
	   switchPage("listview2");
	}
					
	function czFunc(v,r){
	   if(r[6]=="初始化") 
	   return	"<a href=# onclick=\"xiugai("+r[0]+",'"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"');return false;\">修改</a>"
	   else return "<a href=# ><font color=\"gray\">修改</font></a>"
	}
		
	function delFunc(v,r){
	   if(r[6]=="初始化") 
	   return   "<a href=# onclick=\"del("+r[0]+");return false;\">删除</a>"
	   else return  "<a href=# ><font color=\"gray\">删除</font></a>"
	}
			
	function tijiaoFunc(v,r){
	   if(r[6]=="初始化")
	   return   "<a href=# onclick=\"tijiao("+r[0]+");return false;\">提交</a>"
	   else return  "<a href=# ><font color=\"gray\">提交</font></a>"
	}
	
	function onNew(){
	   $("viewdate2").cardnumber.value="";
	   $("customername4").innerHTML="";
	   $("idnotype").innerHTML="";
	   $("idno").innerHTML="";
	   $("listtime4").innerHTML="";
	   $("expiredTime").innerHTML="";
	   $("expiredTime").innerHTML="";
	   switchPage("listview2");
    }
		
	  //选择单位控件
	function selOrg(){	
	   var c = openDialogFrame("/client/card_list.html",'选择卡号',450,600);

	   if(c){
	   $("viewdate2").cardnumber.value=c[1];   
	   $("customername4").innerHTML=c[2];	
	   $("idnotype").innerHTML=c[4];
	   $("idno").innerHTML=c[5];
	   $("currentgrade4").innerHTML=c[6];
	   $("listtime4").innerHTML=c[7];
	   $("expiredTime").innerHTML=c[8];
	  }		
	}
	
    function showData2(){
       switchPage("listview3");   
    }
     
    function   save(){
       var nextGrade=$("viewdate5").nextGrade5.value;
       var gradeid = $("viewdate5").gradeid.value; 
       DWR.call('gradeService.gradeUpdate',nextGrade,gradeid,function(v){
	   createTable();
	   showData1();
	   switchPage('listview');
	  });
    }
   
    function   addgrade(){
       var   cardid =  $("viewdate2").cardnumber.value;
       var   nextGrade = $("viewdate2").nextGrade4.value ; 
       DWR.call('gradeService.gradeChangeAdd',cardid,nextGrade,function(v){    
	   createTable();
	   showData1();
	   switchPage('listview');
	   });
    }
     
    function send1(){  
       switchPage("listview4");
    }
	</script>
</head>
<body onload="load()">
<!--页面导航-->
<div class=" nav ">
<div id="nav">&nbsp;</div>
</div>
<div id="content"><!--查询静态页面部分-->
<div id=listview>
<div class="formTitle">查 询</div>
<div class="form">
<form name="viewdate" id="viewdate">
<div class="searchForm">
<table cellSpacing="0" cellPadding="4" width="100%" border="0"
	class="col2 label6">
	<tr>
		<td><label>卡号</label> <input type="text" name="cardid"
			id="cardid"   value="" onblur="checkV(this,'asn')"  /></td>
			<td><label>客户姓名</label> <input type="text" name="customer"
			id="customer"   value=""   /></td>
	</tr>
	<tr>
	   <td><label>操作类型</label> <select name="operateType"></select></td>
		<td><label>状态</label> <select name="state"></select></td>
	</tr>
	<tr>
	<td></td>
	 <td><button type="button" onclick="showData1()">查 询</button>
	</td>
    </tr>
</table>
</div>
</form>
</div>
<div id="datalist"></div>
</div>

<div id="listview2" style="display: none;">
<div class="formTitle">客户帐号查询</div>
<div class="form">
<form name="viewdate2" id="viewdate2">
<div class="searchForm2">
<table cellSpacing="0" cellPadding="4" width="100%" border="0"
	class="col2 label6">
	<tr>
		<td><label>查询卡号</label> <input type="text" name="cardnumber"
			id='cardnumber' onblur="checkV(this,'',true)" readonly
			class="readonly" onChange="change()"><a class=orga href=#
			onclick="selOrg()">&nbsp;&nbsp;</a><font class="des">*</font></td>
		</td>
		<td><label>客户姓名</label> <span id="customername4"></span></td>
	</tr>
	<tr>
	    <td><label>证件类型</label> <span id="idnotype"></span></td>
		<td><label>证件号</label> <span id="idno"></span></td>
	</tr>
	<tr>
		<td><label>发卡时间</label> <span id="listtime4"></span></td>
		<td><label>有效时间</label> <span id="expiredTime"></span></td>
	</tr>
	<tr>
		<td><label>当前级别</label> <span id="currentgrade4"></span></td>
		<td><label>改变级别</label><select name="nextGrade4"></select></td>
	</tr>
	<tr>
	<td></td>
	<td>
	<button type="button" onclick="addgrade()">增加</button>
	<button type="button" onclick="fanhui1()">返回</button>
	</td>
	<td></td>
</tr>
</table>
</div>
</form>
</div>
</div>

<div id="listview3" style="display: none;">
<div class="formTitle">客户信息变更</div>
<div class="form">
<form name="viewdate3" id="viewdate3">
<div class="searchForm3">
<table cellSpacing="0" cellPadding="4" width="100%" border="0"
	class="col2 label6">
	<tr>
		<td><label>卡号</label> <span id="cardid2"></span></td>
		<td><label>客户姓名</label><span id="username"></span></td>
	</tr>
	<tr>
		<td><label>客户当前级别</label><span id="currentLevel"></span></td>
		<td><label>客户改变级别</label><select name="nextGrade"></select></td>
	</tr>
	<tr>
		<td></td>
		<td>
		<button type="button" onclick="send()">提交审核</button>
		<button type="button" onclick="fanhui2()">返回</button>
		</td>
	</tr>
</table>
</div>
</form>
</div>
<div id="datalist"></div>
</div>

<div id="listview4" style="display: none;">
<div class="formTitle">提交审核</div>
<div class="form">
<form name="viewdate4" id="viewdate4">
<div class="searchForm4">
<table cellSpacing="0" cellPadding="4" width="100%" border="0"
	class="col2 label6">
	<tr>
		<td><label>卡号</label> <span id="cardid2"></span></td>
		<td><label>客户姓名</label><span id="username"></span></td>
	</tr>
	<tr>
		<td><label>客户当前级别</label><span id="currentLevel"></span></td>
		<td><label>客户改变级别</label><select name="nextGrade"></select></td>
	</tr>
	<tr>
		<td>
		<button type="button" onclick="send()">提交审核</button>
		</td>
	</tr>
</table>
</div>
</form>
</div>
<div id="datalist"></div>
</div>

<div id="xiugaiview" style="display: none;">
<div class="formTitle">修改等级</div>
<div class="form">
<form name="viewdate5" id="viewdate5">
<div class="searchForm5">
<table cellSpacing="0" cellPadding="4" width="100%" border="0"
	class="col2 label6">
	<input type="hidden" name="gradeid" id="gradeid" />
	<tr>
		<td><label>卡号</label> <span id="cardid5"></span></td>
		<td><label>客户姓名</label><span id="username5"></span></td>
	</tr>
	<tr>
        <td><label>操作类型</label> <span id="operatorType5"></span></td>
		<td><label>状态</label><span id="state5"></span></td>
	</tr>
	<tr>
		<td><label>当前级别&nbsp;&nbsp;</label><span id="currentLevel5"></span></td>
		<td><label>改变级别&nbsp;&nbsp;</label><select name="nextGrade5"></select></td>
	</tr>
	<tr>
		<td></td>
		<td>
		<button type="button" onclick="save()">保存变更</button>
		<button type="button" onclick="fanhui1()">返回</button>
		</td>
	</tr>
</table>
</div>
</form>
</div>
<div id="datalist"></div>
</div>
</body>
</html>